package com.practice.json和实体属性名不一致时的转化问题;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import java.util.List;

/**
 * @program: tenghw-practice-demo
 * @author: tenghw
 * @create: 2024-10-10 19:18
 * @Version 1.0
 * @description:
 **/
public class Demo {
    public static void main(String[] args) {
        // 写一个属性有id,stu_name,stu_price属性的json数组

        String json = "[{\"id\":1,\"stu_name\":\"张三\",\"stu_price\":100.12},{\"id\":2,\"stu_name\":\"李四\",\"stu_price\":200.00}]";
        JSONArray jsonArray = JSON.parseArray(json);
        List<Student> stus = jsonArray.toJavaList(Student.class);
        System.out.println(stus);

    }
}